//
//  ShopButton.m
//  FreeTrip
//
//  Created by 352324497@qq.com on 15/11/25.
//  Copyright © 2015年 邓芮. All rights reserved.
//

#import "ShopButton.h"

@implementation ShopButton

-(void)setFrame:(CGRect)frame
{
    [_textLabel removeFromSuperview];
    [_customImageView removeFromSuperview];
    
    CGFloat x = (frame.size.width - 32 * KScreenWidth / 375) / 2;
    
    // 创建视图
    _customImageView = [[UIImageView alloc]initWithFrame:CGRectMake(x, 0, 32 * KScreenWidth / 375, 32 * KScreenWidth / 375)];
    [self addSubview:self.customImageView];
    
    _textLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 32 * KScreenWidth / 375 - 30 * KScreenWidth / 375, frame.size.width, frame.size.height - 32 * KScreenWidth / 375)];
    _textLabel.textAlignment = NSTextAlignmentCenter;
    _textLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:self.textLabel];
    
    [super setFrame:frame];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
